﻿name("Moderator Control Panel Handler Tests");

runner.navigateTo("http://www.neoseeker.com/members/modcp.php");

test("Items in moderation queue", function () {
    var actual = runner.$("form table table tr").length;

    ok(actual >= 4, "There should be at least six rows in the table: two title rows and four content rows, which means there are at least two messages in the moderation queue. Found: " + actual);
});

test("Invert checked button added", function () {
    var button = runner.$("input[name=namfox-mod-queue-invert-checked]");

    equal(1, button.length, "Invert checked button not added for messages in mod queue.");
});

test("Invert checked button checks all check boxes", function () {
    runner.$("input[name=namfox-mod-queue-invert-checked]").click();

    var checkboxes = runner.$("input[name=selected_arr\\[\\]]");

    ok(Enumerable.From(checkboxes).All(function (c) { return c.checked; }), "All checkboxes should be checked.");
});

test("Invert checked button unchecks all check boxes", function () {
    runner.$("input[name=namfox-mod-queue-invert-checked]").click();

    var checkboxes = runner.$("input[name=selected_arr\\[\\]]");

    ok(Enumerable.From(checkboxes).All(function (c) { return !c.checked; }), "All checkboxes should be unchecked.");
});

runner.closeWindow();